﻿using System.Collections.Generic;
using Mono.Cecil;
using Mono.Cecil.Cil;

public static class Patcher
{
    // List of assemblies to patch
    public static IEnumerable<string> TargetDLLs { get; } = new[] { "Assembly-CSharp.dll" };

    // Patches the assemblies
    public static void Patch(AssemblyDefinition assembly)
    {
        // Patcher code here

        foreach (TypeDefinition type in assembly.MainModule.Types)
        {
            if (type.Name == "GraphicsResolution")
            {
                foreach (MethodDefinition method in type.Methods)
                {
                    if (method.Name == "IsAspectRatioWithinLimit")
                    {
                        foreach (Instruction ins in method.Body.Instructions)
                        {
                            //if (ins.OpCode.Name == "ldstr" && (string)ins.Operand == "Hello, World!")
                            if (ins.OpCode.Name == "brfalse.s")
                            {
                                ins.OpCode = OpCodes.Brtrue_S;
                            }
                        }
                    }
                }
            }
        }
    }
}